<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="UTF-8" />
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="viewport" content="width=device-width, initial-scale=1.0" />
        <title>Document</title>
    </head>
    <body>
        <script src="../js/lodash.js"></script>
        <script>
            console.log(_.times);
            _.times(10, function (i) {
                console.log(i, 1);
            });
            let obj = [
                { pet: [{ name: "dog1" }, { name: "dog2" }] },
                { pet: [{ name: "dog3" }, { name: "dog4" }] },
            ];
            console.log(_.map(obj, (item) => item.pet[0].name));
            console.log(_.map(obj, "pet"));

            let obj1 = _.clone(obj);
            obj[0].pet[0].name = "dog5";
            console.log(obj, obj1);

            console.log(_.includes({ user: "fred", age: 40 }, "fred"));

            _.forEach({ a: 1, b: 2 }, function (value, key) {
                console.log(key);
            });

            console.log(_.isEmpty({ name: 1 }));

            let users = [
                { user: "barney", age: 36, active: true },
                { user: "fred", age: 1, active: false },
                { user: "pebbles", age: 1, active: true },
            ];
            // console.log(_.find(users, { age: 1, active: true }));
            console.log(_.find(users, ['age',1]));
            console.log(_.filter(users, function(o) { return o.active; }));
        </script>
    </body>
</html>
